package org.innovasix.educational.javap.domain;

import java.util.logging.Logger;

import org.innovasix.educational.javap.domain.datatypes.cp_info;
import org.innovasix.educational.javap.domain.datatypes.u2;
import org.innovasix.educational.javap.domain.datatypes.u4;
import org.innovasix.educational.javap.domain.parser.ClassParser;

/**
 * The binary representation of a class file follows a certain structure which is the ClassFile structure.
 * 
 * @author sven.mentl@gmail.com
 *
 */
public class ClassFile {
	
	private byte[] underlyingClass;
	
	private u4 magic; 
	
	private u2 minor_version; 
	
	private u2 major_version; 
	
	private u2 constant_pool_count; 

	private cp_info[] constant_pool;
	
	private u2 access_flags; 
	
	private u2 this_class;
	
	private u2 super_class;
	
	private u2 interfaces_count;
	
	private Object interfaces;
	
	private u2 fields_count;
	
	private Object field_info;
	
	private u2 methods_count;
	
	private Object methods;
	
	private u2 attributes_count;
	
	private Object attributes;

	private static final Logger log = Logger.getLogger(ClassFile.class.getName());
	
	public byte[] getUnderlyingClass() {
		return underlyingClass;
	}

	public void setUnderlyingClass(byte[] underlyingClass) {
		this.underlyingClass = underlyingClass;
		log.info("underlyingClass set");
	}

	public u4 getMagic() {
		return magic;
	}

	public void setMagic(u4 magic) {
		this.magic = magic;
		log.info("magic set to " + magic);
	}

	public u2 getMinor_version() {
		return minor_version;
	}

	public void setMinor_version(u2 minor_version) {
		this.minor_version = minor_version;
		log.info("minor_version set to " + minor_version);
	}

	public u2 getMajor_version() {
		return major_version;
	}

	public void setMajor_version(u2 major_version) {
		this.major_version = major_version;
		log.info("major_version set to " + major_version);
	}

	public u2 getConstant_pool_count() {
		return constant_pool_count;
	}

	public void setConstant_pool_count(u2 constant_pool_count) {
		this.constant_pool_count = constant_pool_count;
		log.info("constant_pool_count set to " + constant_pool_count);
	}

	public cp_info[] getConstant_pool() {
		return constant_pool;
	}

	public void setConstant_pool(cp_info[] constant_pool) {
		this.constant_pool = constant_pool;
		log.info("constant_pool set");
	}

	public u2 getAccess_flags() {
		return access_flags;
	}

	public void setAccess_flags(u2 access_flags) {
		this.access_flags = access_flags;
		log.info("access_flags set to " + access_flags);
	}

	public u2 getThis_class() {
		return this_class;
	}

	public void setThis_class(u2 this_class) {
		this.this_class = this_class;
		log.info("this_class set to " + this_class);
	}

	public u2 getSuper_class() {
		return super_class;
	}

	public void setSuper_class(u2 super_class) {
		this.super_class = super_class;
		log.info("super_class set to " + super_class);
	}

	public u2 getInterfaces_count() {
		return interfaces_count;
	}

	public void setInterfaces_count(u2 interfaces_count) {
		this.interfaces_count = interfaces_count;
		log.info("interfaces_count set to " + interfaces_count);
	}

	public Object getInterfaces() {
		return interfaces;
	}

	public void setInterfaces(Object interfaces) {
		this.interfaces = interfaces;
	}

	public u2 getFields_count() {
		return fields_count;
	}

	public void setFields_count(u2 fields_count) {
		this.fields_count = fields_count;
		log.info("fields_count set to " + fields_count);
	}

	public Object getField_info() {
		return field_info;
	}

	public void setField_info(Object field_info) {
		this.field_info = field_info;
	}

	public u2 getMethods_count() {
		return methods_count;
	}

	public void setMethods_count(u2 methods_count) {
		this.methods_count = methods_count;
		log.info("methods_count set to " + methods_count);
	}

	public Object getMethods() {
		return methods;
	}

	public void setMethods(Object methods) {
		this.methods = methods;
	}

	public u2 getAttributes_count() {
		return attributes_count;
	}

	public void setAttributes_count(u2 attributes_count) {
		this.attributes_count = attributes_count;
		log.info("attributes_count set to " + attributes_count);
	}

	public Object getAttributes() {
		return attributes;
	}

	public void setAttributes(Object attributes) {
		this.attributes = attributes;
	}
	
	

}
